home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
tex-k
/
tex-k-archive.past
/
1994.11.gz
/
1994.11
/
000279_owner-test-k@cs.umb.edu_Wed Nov 30 01:20:11 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-11-30
|
3KB
Received: by cs.umb.edu id AA01733
(5.65c/IDA-1.4.4 for tex-k-outgoing); Wed, 30 Nov 1994 06:21:35 -0500
Received: from terminus.cs.umb.edu by cs.umb.edu with SMTP id AA01722
(5.65c/IDA-1.4.4 for <tex-k-cs@cs.umb.edu>); Wed, 30 Nov 1994 06:21:26 -0500
Received: by terminus.cs.umb.edu id AA17313
(5.65c/IDA-1.4.4 for tex-k); Wed, 30 Nov 1994 06:20:11 -0500
Date: Wed, 30 Nov 1994 06:20:11 -0500
From: "K. Berry" <kb@cs.umb.edu>
Message-Id: <199411301120.AA17313@terminus.cs.umb.edu>
To: charnier@lirmm.fr
Cc: tex-k@cs.umb.edu, mike@cs.utah.edu
Subject: check SMART_PUTENV under FreeBSD?
Sender: owner-test-k@cs.umb.edu
Precedence: bulk
5) I used SMART_PUTENV, run time error in function assert otherwise.
Several people have reported that configure's test for SMART_PUTENV,
contributed by mike@cs.utah.edu, doesn't work. I don't have FreeBSD, so
can't check myself.
The people who have investigated said that taking out the #if 0 and
#endif in the test showed that it was computing the right thing (i.e.,
it printed `#define SMART_PUTENV'). So I am extremely puzzled. The
only thing that configure cares about is the return status -- supposed
to be zero if SMART_PUTENV, nonzero otherwise.
Can you or someone track this down for real?
I suppose configure could just check for freebsd, but that seems a poor
solution. Better to discover what is really wrong with the test.
#define VAR "YOW_VAR"
#define STRING1 "GabbaGabbaHey"
#define STRING2 "Yow!!" /* should be shorter than STRING1 */
extern char *getenv (); /* in case char* and int don't mix gracefully */
main ()
{
char *str1, *rstr1, *str2, *rstr2;
str1 = getenv (VAR);
if (str1)
exit (1);
str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1);
if (str1 == 0)
exit (2);
strcpy (str1, VAR);
strcat (str1, "=");
strcat (str1, STRING1);
if (putenv (str1) < 0)
exit (3);
rstr1 = getenv (VAR);
if (rstr1 == 0)
exit (4);
rstr1 -= strlen (VAR) + 1;
if (strncmp (rstr1, VAR, strlen (VAR)))
exit (5);
str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1);
if (str2 == 0 || str1 == str2)
exit (6);
strcpy (str2, VAR);
strcat (str2, "=");
strcat (str2, STRING2);
if (putenv (str2) < 0)
exit (7);
rstr2 = getenv (VAR);
if (rstr2 == 0)
exit (8);
rstr2 -= strlen (VAR) + 1;
#if 0
printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2);
/*
* If string from first call was reused for the second call,
* you had better not do a free on the first string!
*/
if (rstr1 == rstr2)
printf ("#define SMART_PUTENV\n");
else
printf ("#undef SMART_PUTENV\n");
#endif
exit (rstr1 == rstr2 ? 0 : 1);